// Copyright 2022 jeff.li. and/or its affiliates.

#include <gtest/gtest.h>
#include <tbir/runtime/container.h>
#include <tbir/runtime/runtime_value.h>
#include <iostream>

namespace tbir::runtime {

    TEST(Runtime, Printer) {
        {
            List abc{"abc", U"hello", 1};
            {
                std::stringstream stream;
                stream << abc;
                auto repr = stream.str();
                EXPECT_EQ(repr, "[b'abc', \'hello\', 1]");
            }
            {
                std::stringstream stream;
                stream << RTValue(abc);
                auto repr = stream.str();
                EXPECT_EQ(repr, "[b'abc', \'hello\', 1]");
            }
        }
        {
            Dict abc{{"abc",    U"abc"},
                     {U"hello", "hi"}};
            {
                std::stringstream stream;
                stream << abc;
                auto repr = stream.str();
                EXPECT_EQ(repr, "{b'abc': \'abc\', \'hello\': b\'hi\'}");
            }
            {
                std::stringstream stream;
                stream << RTValue(abc);
                auto repr = stream.str();
                EXPECT_EQ(repr, "{b'abc': \'abc\', \'hello\': b\'hi\'}");
            }
        }
    }

}  // namespace tbir::runtime
